package com.qys.livesMall.shop.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.qys.livesMall.common.result.R;
import com.qys.livesMall.shop.modal.entity.ShopCart;
import com.qys.livesMall.shop.modal.entity.ShopGoodsSkuStocks;

import java.util.List;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author gmx
 * @since 2023-06-13
 */
public interface ShopGoodsSkuStocksService extends IService<ShopGoodsSkuStocks> {

    /***
     * 库存递减
     * @param carts
     */
    R decount(List<ShopCart> carts);


    R decount(Long skuId, Integer num);

    ShopGoodsSkuStocks queryBySkuId(Long skuId);

    Integer totalStockNum(Long shopId);

    /**
     * 可使用库存量
     * @param shopId
     * @return
     */
    Integer totalStockNumOfUse(Long shopId);

    boolean upStockNum(ShopGoodsSkuStocks stock,Integer oldNum);

    List<Long> getShopIdByNum(Long skuId,List<Long> shopIds);
}
